#include <bits/stdc++.h>
using namespace std;

int main(){
	int a,b,c,d;
	cin >> a >> b;
	c = (4*a-b)/2;
	d = (b-c*2)/4; 
	cout << c << "\n" << d;
	return 0;
}
